﻿using System;
using System.Linq.Expressions;
using System.Collections.Generic;

namespace PMngr.Main
{
    public class ProfileReport
    {
        public static IDictionary<string, string> Dict = new Dictionary<string, string>
           {
               {"Name", "姓名"},
               {"Nationality", "民族"},
               {"BirthDate", "出生日期"},
               {"Gender", "性别"},
               {"SchoolRecord", "学历"},
               {"SchoolLevel", "学位"},
               {"PolicyFace", "政治面貌"},
               {"MarriedDate", "结婚日期"},
               {"College", "毕业院校"},
               {"Major", "专业"},
               {"InUnit", "调入单位"},
               {"OutUnit", "调出单位"},
               {"ProfPos", "职务"},
               {"ProfTitle", "职称"},
               {"PersonalIdentity", "本人身份"},
               {"TechGrade", "技术等级"},
               {"WorkKind", "从事工种"},
               {"WorkStart", "参加工作时间"},
               {"SalaryGrade", "工资级别"},
               {"RecordDate", "填卡日期"},
               {"ApprovalDate", "审批日期"},
               {"TransferReason", "调动理由"},
               {"Family", "随迁人口"},
               {"Remark1", "备注1"},
               {"Remark2", "备注2"},
               {"InUnitMajor", "调入主管部门"},
               {"InUnitType", "调入单位区域"},
               {"InUnitKind", "调入单位性质"},
               {"OutUnitMajor", "调出主管部门"},
               {"OutUnitType", "调出单位区域"},
               {"OutUnitKind", "调出单位性质"},
               {"WholeTransferId","WholeTransferId"}               
           };

        public string Name { get; set; }
        public string Gender { get; set; }
        public string Nationality { get; set; }
        public DateTime? BirthDate { get; set; }
        
        public string SchoolRecord { get; set; }
        public string SchoolLevel { get; set; }

        public string ProfPos { get; set; }
        public string ProfTitle { get; set; }

        public string PersonalIdentity { get; set; }
        public string PolicyFace { get; set; }
        public DateTime? MarriedDate { get; set; }
        public string College { get; set; }
        public string Major { get; set; }
        //
        public string OutUnit { get; set; }
        public string OutUnitKind { get; set; }
        public string OutUnitMajor { get; set; }
        public string OutUnitType { get; set; }
        //
        public string InUnit { get; set; }
        public string InUnitKind { get; set; }
        public string InUnitMajor { get; set; }
        public string InUnitType { get; set; }
        //
        public string TechGrade { get; set; }
        public string WorkKind { get; set; }
        public DateTime? WorkStart { get; set; }
        public string Family { get; set; }
        public string SalaryGrade { get; set; }
        public DateTime RecordDate { get; set; }
        public string TransferReason { get; set; }
        public string Remark1 { get; set; }
        public string Remark2 { get; set; }
        // 审批时间
        public DateTime? ApprovalDate { get; set; }
        // 整体划转
        public int? WholeTransferId { get; set; }      
        // get property native name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetPropertyName<T>(Expression<Func<ProfileReport, T>> func)
        {
            return GetPropertyImpl(func);
        }
        // get property friendly name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetFriendlyName<T>(Expression<Func<ProfileReport, T>> func)
        {
            var name = GetPropertyImpl(func);
            return name != null ? Dict[name] : null;
        }
        [System.Diagnostics.DebuggerStepThrough]
        private static string GetPropertyImpl(LambdaExpression expression)
        {
            var member = expression.Body as MemberExpression;
            return member != null ? member.Member.Name : null;
        }
    }

    public class ProfileModel
    {
        public static IDictionary<string, string> Dict = new Dictionary<string, string>
           {
               {"UserId", "UserId"},
               {"Checked", "选择"},
               {"Name", "姓名"},
               {"Nationality", "民族"},
               {"BirthDate", "出生日期"},
               {"Gender", "性别"},
               {"SchoolRecord", "学历"},
               {"SchoolLevel", "学位"},
               {"PolicyFace", "政治面貌"},
               {"MarriedDate", "结婚日期"},
               {"College", "毕业院校"},
               {"Major", "专业"},
               {"InUnit", "调入单位"},
               {"OutUnit", "调出单位"},
               {"ProfPos", "职务"},
               {"ProfTitle", "职称"},
               {"PersonalIdentity", "本人身份"},
               {"TechGrade", "技术等级"},
               {"WorkKind", "从事工种"},
               {"WorkStart", "参加工作时间"},
               {"SalaryGrade", "工资级别"},
               {"RecordDate", "填卡日期"},
               {"ApprovalDate", "审批日期"},
               {"TransferReason", "调动理由"},
               {"Remark1", "备注1"},
               {"PrintDate", "PrintDate"},
               {"WholeTransferId","WholeTransferId"},
               {"Family", "随迁人口"}
           };

        public bool Checked { get; set; }
        public int UserId { get; set; }
        public string Name { get; set; }
        public string Nationality { get; set; }
        public DateTime? BirthDate { get; set; }
        public string Gender { get; set; }
        public string SchoolRecord { get; set; }
        public string SchoolLevel { get; set; }
        public string PolicyFace { get; set; }
        public DateTime? MarriedDate { get; set; }
        public string College { get; set; }
        public string Major { get; set; }
        //
        public string OutUnit { get; set; }
        public string InUnit { get; set; }
        //
        public string ProfPos { get; set; }
        public string ProfTitle { get; set; }
        public string PersonalIdentity { get; set; }
        public string TechGrade { get; set; }
        public string WorkKind { get; set; }
        public DateTime? WorkStart { get; set; }
        public string Family { get; set; }
        public string SalaryGrade { get; set; }
        public DateTime RecordDate { get; set; }
        public string TransferReason { get; set; }
        public string Remark1 { get; set; }
        // 审批时间
        public DateTime? ApprovalDate { get; set; }

        public DateTime? PrintDate { get; set; }
        // 整体划转
        public int? WholeTransferId { get; set; }
        // get property native name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetPropertyName<T>(Expression<Func<ProfileModel, T>> func)
        {
            return GetPropertyImpl(func);
        }
        // get property friendly name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetFriendlyName<T>(Expression<Func<ProfileModel, T>> func)
        {
            var name = GetPropertyImpl(func);
            return name != null ? Dict[name] : null;
        }
        [System.Diagnostics.DebuggerStepThrough]
        private static string GetPropertyImpl(LambdaExpression expression)
        {
            var member = expression.Body as MemberExpression;
            return member != null ? member.Member.Name : null;
        }
    }

    public class WholeTransferModel
    {
        public static readonly IDictionary<string, string> Dict = new Dictionary<string, string>
           {
               {"Id", "Id"},
               {"Checked", "选择"},               
               {"InUnit", "划入单位"},
               {"OutUnit", "划出单位"},
               {"TransferFile", "整体划转文件"},
               {"Description", "描述"},
               {"RecordDate", "填卡日期"},
               {"ApprovalDate", "审批日期"},
               {"Approved", "是否审批结束"}
           };

        public bool Checked { get; set; }
        public int Id { get; set; }
        public string OutUnit { get; set; }
        public string InUnit { get; set; }
        public string TransferFile { get; set; }
        public string Description { get; set; }

        public DateTime RecordDate { get; set; }
        public DateTime? ApprovalDate { get; set; }
        public bool Approved { get; set; }
        
        // get property native name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetPropertyName<T>(Expression<Func<WholeTransferModel, T>> func)
        {
            return GetPropertyImpl(func);
        }
        // get property friendly name
        [System.Diagnostics.DebuggerStepThrough]
        public static string GetFriendlyName<T>(Expression<Func<WholeTransferModel, T>> func)
        {
            var name = GetPropertyImpl(func);
            return name != null ? Dict[name] : null;
        }
        [System.Diagnostics.DebuggerStepThrough]
        private static string GetPropertyImpl(LambdaExpression expression)
        {
            var member = expression.Body as MemberExpression;
            return member != null ? member.Member.Name : null;
        }
    }

}
